import { RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/layout.vue';

const arr : Array<RouteRecordRaw> = [
  {
    path: '/login',
    component: Layout,
    redirect: '/login/index',
    meta: { title: '登陆', icon: 'el-icon-menu' },
    children: [{
      path: 'index',
      component: () => import('@/views/login/login.vue'),
      meta: {
        title: '登陆',
        icon: '首页',
        keepAlive: true,
        enterClass: 'slideInRight',
        leaveClass: 'slideOutLeft'
      }
    }]

  },
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      name: 'Dashboard',
      component: () => import('@/views/dashboard/dashboard.vue'),
      meta: { title: '首页', icon: '首页', keepAlive: true }
    }]
  },
  {
    path: '/redirect',
    component: Layout,
    meta: { hidden: true },
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/redirect.vue'),
      }
    ]
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404.vue'),
    meta: { title: 'error-404', icon: 'el-icon-menu', hidden: true }
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401.vue'),
    meta: { title: 'error-401', icon: 'dashboard', hidden: true }
  },
  // 404 page must be placed at the end !!!
  { path: '/:catchAll(.*)', redirect: '/404', meta: { hidden: true } },
];

export default arr;
